package jstudio.android.piratedefence;

import android.app.Activity;
import android.os.Bundle;
import android.util.DisplayMetrics;
import android.view.Window;
import android.view.WindowManager;
import android.view.View;

public class PirateDefence extends Activity {
	private int screenWidth,screenHeight;
	private int gameState;
	
	private PresentScene presentScene;
	private LoadingScene loadingScene;
	private OptionScene optionScene;
	private LevelScene levelScene;
	private GameScene gameScene;
	private View currentScene;
	
	private ResRepository resRep;
	
	@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        //initialize
        this.requestWindowFeature(Window.FEATURE_NO_TITLE);
        this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
        DisplayMetrics displayMetrics = new DisplayMetrics();
        this.getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
        screenWidth = displayMetrics.widthPixels; screenHeight = displayMetrics.heightPixels;
        //start
        presentScene = new PresentScene(this);
        this.setContentView(presentScene);
    }
	
    @Override
    public void onStart(){
    	super.onStart();
    }
    
    @Override
    public void onResume(){
    	super.onResume();
    	if(currentScene == gameScene && gameScene.getGameState() == 0){ gameScene.resumeGame(); }{ gameScene.resumeGame(); }
    }
    
    @Override
    public void onPause(){
    	super.onPause();
    	if(currentScene == gameScene && gameScene.getGameState() == 1){ gameScene.resumeGame(); gameScene.pauseGame(); }
    }
    
    @Override
    public void onStop(){
    	super.onStop();
    }
    
    @Override
    public void onDestroy(){
    	super.onDestroy();
    }

}
